package com.accenture.adf.newcodington.module12.sample;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * 
 * Topic: Demo on using the Map data type from the Java collection framework
 * 
 * Instructions:
 * 1. Create a 'MapDemo' class
 * 2. Create a main() method that will perform the following functions
 *    a. Create a Map object using the HashMap constructor
 *    b. Populate the map using the put() method
 *    c. Print the values associated with the map key using the get() method
 *    d. Create a Set object that contains all the map keys retrieved using the keySet() method
 *    e. Create a Collection object that contains all the key values retrieved using the 
 *       values() method
 *    d. Print all the map keys and all the key values
 *    
 */

public class MapDemo {
	
	
	public static void main(String[] args) {
			
		// Creating Map object using HashMap implementation
		Map<String, String> map = new HashMap<String, String>();
		
		map.put("event1", "HIGH THRILL_RIDE - PARK");
		map.put("event2", "LOW THRILL_RIDE - PARK");
		map.put("event3", "HIGH THRILL_RIDE - ZOO");
		map.put("event4", "LOW THRILL_RIDE - ZOO");
		
		//beware of using the same key twice cause it will overwrite the value
		System.out.println(map.get("event1"));
		System.out.println(map.get("event2"));
		System.out.println(map.get("event3"));
		System.out.println(map.get("event4"));
		
		//keys are maintained as set in map
		Set<String> keys = map.keySet();
		//keys are maintained as list in map
		Collection<String> values = map.values();
		
		// Printing Keys and Values in console separately
		System.out.println(keys);
		System.out.println(values);
		
		System.out.println("Map: " + map);
	}
}